 package uk.co.mmscomputing.util;
 
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 public class UtilResources
 {
   private static Locale locale = Locale.getDefault();
   private ResourceBundle messages;
   private String classname;
 
   public UtilResources(Class paramClass)
   {
     this.classname = paramClass.getName().substring(paramClass.getName().lastIndexOf(".") + 1);
     this.messages = ResourceBundle.getBundle(paramClass.getName(), locale);
   }
 
   public String getString(String paramString) {
     try {
       return this.messages.getString(paramString);
     } catch (MissingResourceException localMissingResourceException) {
       return localMissingResourceException.getMessage();
     }
   }
 
   public String getString(String paramString1, String paramString2) {
     try {
       return this.messages.getString(paramString1).replaceAll("%0", paramString2);
     } catch (MissingResourceException localMissingResourceException) {
       return localMissingResourceException.getMessage();
     }
   }
 
   public String getString(String paramString, String[] paramArrayOfString) {
     try {
       String str = this.messages.getString(paramString);
       for (int i = 0; i < paramArrayOfString.length; i++) {
         str = str.replaceAll("%" + i, paramArrayOfString[i]);
       }
       return str;
     } catch (MissingResourceException localMissingResourceException) {
       return localMissingResourceException.getMessage();
     }
   }
 
   public String getErrorString(int paramInt, String paramString)
   {
     try
     {
       return this.messages.getString(this.classname + ".err." + paramInt); } catch (MissingResourceException localMissingResourceException) {
     }
     return "[" + paramInt + "] " + paramString;
   }
 }

